package com.gyc.simple.userservices;

public class LambdaStudy {

    final static String lamfin = "hello!";

    public static void main(String[] args){

        String t = lamfin.intern();


        LambdaStudy lambdaStudy = new LambdaStudy();
        //实现接口方法
        MathOperationa operationa = (int a,int b)->a+b;
        MathOperationa operationa1 = (a,b)->a-b;
        MathOperationa operationa2 = (int a,int b)->{return a*b;};
        MathOperationa operationa3 = (int a,int b)->a/b;

        //MathOperationb mathOperationb = t ->System.out.println("ce "+t);false MathOperationb mathOperationb = lamfin ->System.out.println("ce "+lamfin);与lamfin无关
        MathOperationb mathOperationb = messa ->System.out.println("ce "+messa);
        MathOperationb mathOperationb1 = messa ->System.out.println("hello "+messa);

        System.out.println("10+5="+lambdaStudy.MathOperation(10,5,operationa,mathOperationb));
        System.out.println("10-5="+lambdaStudy.MathOperation(10,5,operationa1,mathOperationb));
        System.out.println("10*5="+lambdaStudy.MathOperation(10,5,operationa2,mathOperationb1));
        System.out.println("10/5="+lambdaStudy.MathOperation(10,5,operationa3,mathOperationb1));


        mathOperationb.sayMessage("shenmmegui");
        mathOperationb1.sayMessage("gyc");

    }
//--------------------------------------------------------------
    interface MathOperationa{
        int operation(int a,int b);

    }

    interface MathOperationb{
        void sayMessage(String msg);
    }

    private int MathOperation(int a,int b,MathOperationa mathOperationa,MathOperationb mathOperationb){
        mathOperationb.sayMessage("ces");
        System.out.println(mathOperationa.operation(a,b));
        System.out.println(mathOperationa.toString());
        return mathOperationa.operation(a, b);
    }
//--------------------------------------------------------------
}
